/**
 * 
 */
package com.bitantenna;

import java.io.IOException;

import com.bitantenna.messages.MessageFrame;


public class StreamConsumer extends SpotTask {
	public StreamConsumer(Spot s) {
		super(s);	
	}
	
	@Override
	public void performTask(Spot spot) throws IOException {			
		AddressedMessage m=spot.receiveFrame();
		MessageFrame frame=(MessageFrame)m.message();		
		
		if (frame.frameType()==MessageFrame.FrameType.header) {			
			spot.onConsumeHeader(m);
		} 
		if (frame.frameType()==MessageFrame.FrameType.sample) {
			spot.onConsumeSample(m);
		}
							
	}				

}